import { axios } from '@/utils/request'

export function login(parameter) {
  return axios({
    url: '/sys/user/login',
    method: 'post',
    data: parameter
  })
}
export function logout() {
  return axios({
    url: '/sys/logout',
    method: 'get'
  })
}
//查询当前登陆用户的基础信息以及菜单信息 
export function getAll() {
  return axios({
    url: '/sys/user/loginUserInfo',
    method: 'get'
  })
}

 //根据userid查询角色信息
export function sysGetBaseUserIdRole(userId) {
  userId = userId !== undefined ? userId : '';
  return axios({
    url: `/sys/user/listUserRoleIds?userId=${userId}`,
    method: 'get'
  })
}
//根据userid查询用户菜单
export function sysGetBaseUserIdMenus(userId) {
  userId = userId !== undefined ? userId : '';
  return axios({
    url: `/sys/user/selectMenusByUserId?userId=${userId}`,
    method: 'get'
  })
}
//根据园区或者企业id查询所有角色信息,  -1表示查询管理端的所有角色
export function sysGetBaseRole(roleRelationId) {
  roleRelationId = roleRelationId !== undefined ? roleRelationId : '';
  return axios({
    url: `/sys/role/listRolesByRelationId?roleRelationId=${roleRelationId}`,
    method: 'get'
  })
}

//上传文件
export function sysBaseUpload(parameter) {
  return axios({
    url: '/sys/common/uploadFile',
    method: 'post',
    data: parameter
  })
}
//上传文件
export function uploadNewFile(parameter) {
  return axios({
    url: '/sys/common/uploadNewFile',
    method: 'post',
    data: parameter
  })
}
  //发送短信验证码
export function sysBaseSendCode(parameter) {
  return axios({
    url: '/sys/common/sendSmsCode',
    method: 'post',
    data: parameter
  })
}
// 所有平台基础信息
export function sysListBaseInfo(params) {
  return axios({
    url: '/sys/hr/admin/park/listBaseInfo',
    method: 'get',
    params
  })
}
//文件共享
export function sysBaseUploadLayout(parameter) {
  return axios({
    url: '/sys/pt/settle/batchUploadSettleFiles',
    method: 'post',
    data: parameter
  })
}
export function sysBaseGetUploadLayout(params) {
  return axios({
    url: '/sys/pt/settle/listSettlementFiles',
    method: 'get',
    params
  })
}
export function sysBaseDelUploadLayout(parameter) {
  return axios({
    url: '/sys/pt/settle/delSettlementFileById',
    method: 'post',
    data: parameter
  })
}
export function sysBaseFiledAdd(parameter) {
  return axios({
    url: '/sys/filed/authorize/addRoleFiledAuthority',
    method: 'post',
    data: parameter
  })
}
export function sysBaseGetRoleIdFiled(roleId) {
  return axios({
    url: '/sys/filed/authorize/selectRoleFiledAuthority?roleId='+roleId,
    method: 'get'
  })
}